#include "../maindef.h"
#include "CSkill.h"

int CSkill::GetMainSkillAffect(CSkillAffect& stSkillAffect)
{
    if (!MainSkillHasMainTargetStru())
    {
        return ERROR_NO_MAIN_SKILL_EFFECT;
    }

    stSkillAffect = _stMainAff;

    return 0;
}

int CSkill::GetMinorSkillAffect(CSkillAffect& stSkillAffect)
{
    stSkillAffect = _stMinorAff;
    return 0;
}

int CSkill::GetGroupSkillAffect(CSkillAffect& stGroupSkillAffect,
        bool bToMainTarget)
{
    if ((bToMainTarget && !MainSkillHasGroupTargetStru()) ||
        (!bToMainTarget && !MinorSkillHasGroupTargetStru()))
    {
        return ERROR_NO_GROUP_SKILL_EFFECT;
    }

    if (bToMainTarget)
    {
        stGroupSkillAffect = _stMainAff;
    }
    else 
    {
        stGroupSkillAffect = _stMinorAff;
    }

    return 0;
}

void CSkill::DumpSkillInfo()
{
    CT_BATTLE(("%-18s = %u", "ID", _uiID));
#if 0
    CT_BATTLE(("%-18s = %d", "类别(1普通 2学院 3幻化)", _iType));
    CT_BATTLE(("%-18s = %d", "消耗怒气", _iUseAnger));
    CT_BATTLE(("%-18s = %d", "消耗生命(千分率)", _iUseHPPercent));
    CT_BATTLE(("%-18s", "主技能功能信息:"));
    _stMainAff.DumpSkillAffectInfo();
    CT_BATTLE(("%-18s", "辅助技能功能信息:"));
    _stMinorAff.DumpSkillAffectInfo();
#endif
}
